const BASEURL = "https://tea.qingnian8.com/api/bizhi"
export function request(config={}){
	let {url,header={},method="GET",data={}} = config
	url = BASEURL+url
	header["access-key"] = '111222333444'
	return new Promise((resolve,rejects)=>{
		uni.request({
			url,
			header,
			method,
			data,
			success: res => {
				if(res.data.errCode===0){
					resolve(res)
				}else if(res.data.errCode===400){
					uni.showModal({
						title:"错误信息",
						content:res.data.errMsg,
						showCancel:false
					})
					rejects(res)
				}else{
					uni.showToast({
						title:res.data.errMsg,
						icon:"none"
					})
					rejects(res)
				}
			},
			fail: err => {
				rejects(err)
			}
		})
	})
}